#ifndef __SE_SSL_H__
#define __SE_SSL_H__
#ifdef __cplusplus
extern "C"
{
#endif //__cplusplus

#define SE_TLS_IS_SERVER 0
#define SE_TLS_IS_CLIENT 1

typedef enum
{
	SE_TLS_SUCCESS,
	SE_TLS_TCP_ONLY, //the return io just for tcp
	SE_TLS_FAIL
}SE_TLS_ERR_CODE;

typedef struct
{
	int sock;
	int isClient;
	int isVerifyPeer;
	
	char* certfile;
	char* keyfile;
	char* cafile;
	
}SE_TLS_CTX_S;

void SE_tls_init();
void SE_init_tlsctx(SE_TLS_CTX_S *se_tls_ctx,int sd, int isClient);
void SE_setTlsCtxCert(SE_TLS_CTX_S *se_tls_ctx,char* certfile, char* keyfile);
SE_TLS_ERR_CODE SE_tls_new(SE_TLS_CTX_S *se_tls_ctx,void** io);
SE_TLS_ERR_CODE SE_tcp_new(int sd, void** io);
int SE_tls_read(void* io,void *out, int outl);
int SE_tls_write(void* io,void *in, int inl);
void SE_tls_delete(void *io);


#ifdef __cplusplus
}
#endif //__cplusplus
#endif